module Enumerable
  def build_hash
    result = {}

    self.each do |elt|
      key, value = yield elt
      result[key] = value
    end

    result
  end
end

class Hash
  def collect!( &blk )
    self.replace( build_hash( &blk ) )
  end

  alias_method :map!, :collect!
end